﻿$(function(){
    $('.comment-form #submit-comment').live('click', function () {           
        submitComment();
    });       
});

function submitComment(){	
	//Create Item object for comment
	var item={
	    postid: $('.comment-form .comment-postid').val(),
	    author: $('.comment-form #author').val(),
	    website: $('.comment-form #website').val(),
	    email: $('.comment-form #email').val(),
	    comment: $('.comment-form #comment').val()
	};
	//Pass comment variables to server using ajax to save state
	var root = $('#WebRoots_GetWebRoot').val();
	$.post(root + 'Modules/viBlog/CommentsList/SubmitComment.aspx', 'data=' + $.toJSON(item), function (data) {
	    $('.comment-list').append(data)
    });	
}